import {getpiedate} from "@/services/welcome/welcome"



const welcome  = {
  namespace: 'welcome',
  state: {
    ownerdata:[],
    creatordata:[],
  },
  effects: {
    *creatorItemList({ payload }, { call, put }) {
      const response = yield call(getpiedate, payload);
      //console.log(response);
      yield put({
        type: 'getcreatorItemList',
        payload: response.data,
      });
    },
    *ownerItemList({ payload }, { call, put }) {
      const response = yield call(getpiedate, payload);
      //console.log(response);
      yield put({
        type: 'getownerItemList',
        payload: response.data,
      });
    },

  },
  reducers: {

    getcreatorItemList(state, { payload }) {
      return { ...state, creatordata: payload };
    },
    getownerItemList(state, { payload }) {
      return { ...state, ownerdata: payload };
    },
    setShowDetail(state, { payload }) {
      return { ...state, showDetail: payload.showDetail, currentRow: payload.currentRow };
    },
  },
};
export default welcome;
